/* 
 * File:   tools.h
 * Author: Ewelle
 *
 * Created on November 18, 2009, 9:21 AM
 */
#include <string.h>
#include "myFtp.h"

#ifndef _TOOLS_H
#define	_TOOLS_H

#ifdef	__cplusplus
extern "C" {
#endif

#define NEW_SESSION 0;
#define OLD_SESSION 1;
#define DISABLED_SESSION 2;

struct read_option {
	int fd;
	int pos;
};
typedef struct read_option read_option;

struct open_out {
	int fd;
	long size;
};
typedef struct open_out open_out;

typedef struct client clients;
struct client {
	char ip[255];
	int port;
        char m_env[255];
	char m_value[255];
	int m_status;
	clients *next;
} ;

clients *liste_Clients;
struct passwd * passwdParams;
char Buffer_Reader[MAX_BUFF_SIZE];

int getService(clients *list, int ip);
int listClient(clients *list);
clients *supprimer(clients *list, char ip[255],int port);
clients *inserer(clients *list, struct client cli);
clients *update(clients *list, struct client cli);
struct client eXist(clients *list, char ip[255], int port);
void setPwd(struct svc_req *rqstp);
void updatePwd(struct svc_req *rqstp);

char **getdir (char *rep);
void split(char *original, char * split1, char * split2, char del);
data_i * read_local(read_option *option);
int putFile(char inFile[255],char outFile[255], CLIENT *cl);
int getFile(char inFile[255],char outFile[255], CLIENT *cl);

#ifdef	__cplusplus
}
#endif

#endif	/* _TOOLS_H */

